Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make @Throws getter functions properties #12

Merged
merged 12 commits into from
Jan 22, 2024
Merged

Make @Throws getter functions properties #12

merged 12 commits into from
Jan 22, 2024

Conversation

jeffdgr8
Copy link
Owner

@jeffdgr8 jeffdgr8 commented Jan 19, 2024

This align's Kotbase's API with how the Couchbase Lite Java SDK appears in Kotlin, allowing for more seamless adoption of Kotbase with existing Kotlin code using Couchbase Lite. It also makes the APIs more idiomatic.

Note: this is a source-incompatible (but binary compatible, at least on JVM) change from Kotbase 3.0.x.

Instead of:

database.getIndexes()
replicator.getPendingDocumentIds()

now:

database.indexes
replicator.pendingDocumentIds

Most affected APIs are still unreleased until 3.1.

This change requires working around KT-63047, so these APIs do not appear as error throwing in native code. But the common Kotlin and JVM APIs are annotated @get:Throws.

It's expected the primary usage for the APIs is in common Kotlin code, but for Objective-C, the properties are hidden with @HiddenFromObjC and functions annotated @Throws are provided to allow for error handling in Swift and Objective-C.

// in Swift
try database.indexes()
try replicator.pendingDocumentIds()

@jeffdgr8 jeffdgr8 merged commit dc7444f into main Jan 22, 2024
4 checks passed
@jeffdgr8 jeffdgr8 deleted the throw-getters branch January 22, 2024 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant